yjx.controller('todoController',['$rootScope','$scope','$fetch','modalService','$state','$timeout','$init',function ($rootScope,$scope,$fetch,modalService,$state,$timeout,$init) {
    var shareMsg = "请点击右上角\"...\"完成对客户的转发";
    $init.title("待办事项");
    // var btnValue = "知道了"
    $scope.forward = function (contentId,id,type) {
        //alert(id);
        if(type == 1) {
            $state.go('surDetail',({id:contentId,forwardId:null,pendingEventId:id}))
        } else if(type == 2) {
            $state.go('productDetail',({id:contentId,forwardId:null,pendingEventId:id}))
        }else{
            $state.go('bannerDetail',({id:contentId,forwardId:null,pendingEventId:id}))
        }
    }
/**swiper */
    var tabList, todoSwiper;
    var width = document.body.offsetWidth;
   $scope.tabList = [{id:1,name:'客户'},{id:2,name:'订单'},{id:3,name:'转发'}];
   $scope.curTab = $scope.tabList[0];

    function buildSwiper() {
        tabList = new Swiper('#tabList', {
            slidesPerView: 3,
            slideToClickSlide:true
        });
        todoSwiper = new Swiper('#todoSwiper', {
            direction: 'horizontal',
            slider: width,
            on: {
                slideNextTransitionStart: function () {
                    tabList.slideTo(todoSwiper.activeIndex)
                    $timeout(function () {
                        $scope.curTab = $scope.tabList[todoSwiper.activeIndex];
                    })
                },
                slidePrevTransitionStart: function () {
                    tabList.slideTo(todoSwiper.activeIndex - 1)
                    $timeout(function () {
                        $scope.curTab = $scope.tabList[todoSwiper.activeIndex];
                    })
                }
            }
        })
    }
    $timeout(function(){
        buildSwiper();
    },1000)
 
    $scope.tabSelect = function (item,index) {
        $scope.curTab = item;
        todoSwiper.slideTo(index , 500);
    }
}])